// 手牌一
class playRemind extends eui.Component{
    private bg:eui.Image;
    private txt:eui.Label;
    public constructor(){
        super();
        this.once(eui.UIEvent.COMPLETE,this.onComplete,this);
        this.skinName = "src/Game/gameRoom/chat/playRemindSkin.exml";
    }
    private onComplete(){
        this.visible = false;   
        this.touchEnabled = false;
        this.touchChildren = false;
    }
    private timer;
    public setContent(str:string){
        if(!str) return;
        this.visible = true;   
        this.alpha = 1;     
        this.txt.x = 18;
        this.txt.y = 6;
        this.txt.size = 26;
        this.txt.multiline = false;
        this.txt.width = StageData.W;
        this.txt.text = str;
        this.txt.width = this.txt.textWidth + (2*str.length);
        this.bg.width = this.txt.width + 5;
        this.width = this.bg.width;
        this.x = (StageData.W - this.width)/2;
        if(this.timer){
            egret.clearTimeout(this.timer);
            this.timer = null;
        } 
        this.timer = egret.setTimeout(()=>{
            egret.clearTimeout(this.timer);
            egret.Tween.removeTweens(this);
            egret.Tween.get(this).to({alpha:0},800).call(()=>{
                egret.Tween.removeTweens(this);
                this.visible = false;
            },this); 
        },this,4000);
    }
}